import time
import unittest
import ddt
from Base.BaseSetings import *
from Business.ClassManagement_wxj import cls_management
from Base.utx import *

@ddt.ddt
class Cls_manage(unittest.TestCase):

    # @classmethod
    # def setUpClass(cls) -> None:
    #     cls.w = cls_management()

    # @classmethod
    # def tearDownClass(cls) -> None:
    #     cls.w.close_browser()

    def setUp(self) -> None:
        self.w = cls_management()

    # def tearDown(self) -> None:
    #     self.w.close_browser()

    @ddt.file_data(TestData_dir + "stu_leave_select_wxj.yaml")
    def test_stu_leave_select(self,**kwargs):   #学员请假信息查询===
        # self.w.login('WNCD000','woniu123')
        info=self.w.stu_leave_select(kwargs.get('region'),kwargs.get('status_leave'),kwargs.get('leave_stu_name'))
        print(info)
        self.assertEqual(info[0][0],kwargs.get('leave_stu_name'))
        self.assertEqual(info[0][9],kwargs.get('status_leave'))
        # self.w.login_out()

    @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
    def test_stu_change(self,**kwargs):    #学员转班===
        # self.w.login('WNCD000','woniu123')
        info=self.w.stu_change(kwargs.get('school_region'),kwargs.get('change_cls'))
        print(info)
        self.assertEqual(info,kwargs.get('except'))
        # self.w.login_out()

    @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
    def test_stu_change_query(self,**kwargs):   #学员转班信息查询===
        # self.w.login('WNCD000','woniu123')
        infos=self.w.stu_change_query(kwargs.get('school_region'),kwargs.get('change_cls'))
        for info in infos:
            print(info)
            if info !=['无符合条件的记录']:
                self.assertEqual(info[3],kwargs.get('change_cls'))
        # self.w.login_out()

    @ddt.file_data(TestData_dir + "cls_manage_wxj.yaml")
    def test_cls_manage(self,**kwargs):    #新增班级
        # self.w.login('WNCD000','woniu123')
        res=self.w.cls_manage(kwargs.get('cls_num'),kwargs.get('direction'),kwargs.get('teacher'))
        print(res)
        self.assertEqual(res,kwargs.get('except'))
        # self.w.login_out()
        # time.sleep(2)


if __name__ == '__main__':
    unittest.main()